<!DOCTYPE html>
<script src="/js-test-resources/ahem.js"></script>
<link rel="stylesheet" href="has-cached-resources.css">
<script src="/js-test-resources/js-test.js"></script>
<script src="url.js"></script>
<script>
if (window.testRunner)
    testRunner.waitUntilDone();

function shouldHavePerformanceInfo(url) {
    shouldNotBe('window.performance.getEntriesByName("' + url + '")', "[]");
}

function shouldNotHavePerformanceInfo(url) {
    shouldBe('window.performance.getEntriesByName("' + url + '")', "[]");
}

onload = function() {
    // Need setTimeout to wait until scheduled resource timing reports are evaluated.
    window.setTimeout(function() {
        var url = baseURL();

        description("Test for crbug.com/337065: resources in cached stylesheet should have resource timing and CDT timeline.");
        shouldHavePerformanceInfo(url + "abe.png");
        shouldNotHavePerformanceInfo(absoluteURL(url + "../../resources/square20.png"));
        shouldHavePerformanceInfo(absoluteURL(url + "../../misc/resources/acid3/font.ttf"));

        if (window.testRunner)
            testRunner.notifyDone();
    }, 0);
}
</script>
<!-- FIXME: need to test the case: this html has not font-family: AcidAhemTest. -->
<!-- In the case, window.performance.getEntriesByName should not return the font's -->
<!-- performance timing info. -->
<!-- Currently, because of CSSFontFaceSrcValue, always returns its info. -->
<div style="font-family: AcidAhemTest">Acid Ahem Test Font</div>
